<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<head>
<title>Login</title>
<!-- for-mobile-apps -->
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="Best Store Responsive web template, Bootstrap Web Templates, Flat Web Templates, Android Compatible web template, 
Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, SonyEricsson, Motorola web design" />
	<div th:include="css :: css"></div>
<!-- //animation-effect -->
</head>
	
<body>
<!-- breadcrumbs -->
	<div class="breadcrumbs">
		<div class="container">
			<ol class="breadcrumb breadcrumb1 animated wow slideInLeft" data-wow-delay=".5s">
				<li><a href="/index"><span class="glyphicon glyphicon-home" aria-hidden="true"></span>主页</a></li>
				<li class="active">登陆</li>
			</ol>
		</div>
	</div>
<!-- //breadcrumbs -->
<!-- login -->
	<div class="login" id="app">
		<div class="container">
			<h3 class="animated wow zoomIn" data-wow-delay=".5s">登陆表单</h3>
			<div class="login-form-grids animated wow slideInUp" data-wow-delay=".5s">
				<form>
					<input type="text" placeholder="用户名"  v-model="user.code" required="required" >
					<input type="password" placeholder="密码"  v-model="user.pwd" required="required" >
					<div class="forgot">
						<a href="/register">注册</a>
					</div>
					<br>
					<input type="button" id="log-btn" class="btn btn-warning"   style="    width: 100%;"  value="登陆">
				</form>
			</div>
		</div>
	</div>
<!-- //login -->
<script>
    var app=new Vue({
        el:'#app',
        data:{
            user:{
                code:"admin",
                pwd:"admin"
            }
        }
    });

    $("#log-btn").click(function(){
        console.log(app.user)
        $.ajax({
            url: '/user/login',
            type: 'post',
            dataType: 'json',
            async: false,
            data: app.user,
            success:function(data){
			console.log(data)
				if (data.code==1001){
					localStorage.shopuserid=data.obj.id;
                    localStorage.name=data.obj.name;
                    window.location.href="/index";

				} else{
			    alert("请从新登陆")
				}
            },
            error:function(){

            }
        });

    });
</script>
</body>
</html>